<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="/css/style2.css" th:href="@{/css/style2.css}">
  <script src="/js/flexible.js" th:src="@{/js/flexible.js}"></script>
  <title>福建农林大学资源与环境学院空间信息与数字技术技能考核</title>
</head>
<body background="/image/image5.jpg">
  <div class="login-container" >
  	<table>
  	<tr>
  		<td>
    <div class="left-container">
      <div class="title"><span th:text="${firstR[0].name}">随机题目1</span></div>
    </div>
    </td>
    <td>
    <div class="left-container1">
      <div class="title"><span th:text="${firstR[1].name}">随机题目2</span></div>
    </div>
    </td>
   </tr>
   </table>
   <table>
   	<tr>
   		<td>
   			<div class="left-container3">
   				<div class="title"><span id="f"></span></div>
   			</div>
    </td>
    </tr>
    <tr>
   		<td>
   			<div class="left-container3">
   				<div class="title"><span id="e"></span></div>
   			</div>
    </td>
    </tr>
   </table>
   
  </div>
  <script src="/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
  <script>
      window.onload=function (){
          gain();
      }
      function gain(){
          setTimeout(gain,1000);
          var obj_lis = document.getElementsByTagName("span");
          for(var i=0;i<obj_lis.length;i++){
              obj_lis[i].onclick = function(){
                  rands($(this).text());
              }
          }
      }
      function rands(sub){
          $.ajax({
              url:"/random2/"+sub,
              dataType:"json",
              type:"post",
              success:function (data) {
                  if(data.chong!=null){
                        alert("注意: 你已经抽过本大类题目了，请抽取另一大类题目!")
                  }else {
                      if(data.exit==null){
                          var i=data.js.length;
                          $("#f").html(data.js[0]);
                          if(i==2){
                              $("#e").html(data.js[1]);
                          }
                      }else{
                          alert("您已经抽过签了，如若遗忘题目，请询问考核老师！")
                      }
                  }


              }
          })}
  </script>
</body>
</html>